<style>
    div#rejection{
        background-color: beige;
        border: 2px #0398CA ridge;
        display: none;
        position: absolute;
        padding: 20px;
        z-index: 100;
    }


    div.containerNotification{
        background-color: black;
        border-style:solid;
        border-color:#242424;
        color: whitesmoke;
        width: 300px;
        Height: 30px;
     }
</style>
<script type="text/javascript" src="<?=$this->baseUrl()?>/js/jquery.cookie.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $("a#link").click(function(){
            $.cookie('prevpage', 'pending');
        });
    });

    function insert_reason(shopId,name){
        var myscreen = getScreen(); //screen-size.js
        document.frmReason.shopId.value = shopId;
        document.frmReason.shopName.value = name;

        var box = document.getElementById("rejection");
        box.style.height = "280px";
        box.style.width = "390px";
        box.style.top = (myscreen.height - parseInt(box.style.height))/2 + "px";
        box.style.left = (myscreen.width - parseInt(box.style.width))/2 + "px";
        box.style.display = 'block';
    }

    function chkReason(){
        if(document.frmReason.reason.value.length==0){
            alert("Mohon masukkan alasan Anda");
            return false;
        }
        else{
            return true;
        }
    }

    function accept(shopId,name){
        document.frmAccept.shopId.value = shopId;
        document.frmAccept.shopName.value = name;
        document.frmAccept.submit();
    }


</script> 
<div id="view-content">
    <table>
        <tr class="top">
            <td colspan="6" style="text-align:right;">
                <img style="margin-bottom:-3px;margin-top:4px;" src="<?php echo $this->baseUrl(); ?>/images/icons/tick.png" /> = Setujui &nbsp;&nbsp;&nbsp;
                <img style="margin-bottom:-3px;margin-top:4px;" src="<?php echo $this->baseUrl(); ?>/images/icons/delete.png" /> = Tolak
            </td>
        </tr>
        <tr class="head">
            <td>Nama Toko</td>
            <td>Nama Pemilik</td>
            <td>Keanggotaan</td>
            <td>Kategori</td>
            <td>Keyword</td>
            <td>Aksi</td>
        </tr>
        <?php
        foreach ($this->shops as $shop) {
        ?>
            <tr style="background-color: <?= $this->cycle(array("#ccffcc","#99ff99"))->next(); ?>;">
                <td>
                    <a id="link" href="<?php echo $this->url(array("controller" => "shop", "action" => "details", "id" => $this->escape($shop["shop_id"]))); ?>">
                    <?php echo $this->escape($shop["name"]); ?>
                </a>
            </td>
            <td><?php echo $this->escape($shop["owner"]); ?></td>
            <td>
                <?php echo $this->escape($shop["ms_name"]); ?>
            </td>
            <td>
                <ul>
                    <?php foreach ($this->shops_type[$shop["shop_id"]] as $cat) { ?>
                    <li><?php echo $this->escape($cat); ?></li>
                    <?php } ?>
                </ul>
            </td>
            <td>
                <ul>
                    <?php foreach ($this->shops_key[$shop["shop_id"]] as $key) { ?>
                    <li><?php echo $this->escape($key); ?></li>
                    <?php } ?>
                </ul>
            </td>
            <td>
                <a href="javascript: accept(<?=$shop["shop_id"].",'".$shop["name"]."'"?>)" title="Setujui">
                    <img src="<?php echo $this->baseUrl(); ?>/images/icons/tick.png" alt="Setujui" />
                </a>&nbsp;
                <a href="javascript: insert_reason(<?=$shop["shop_id"].",'".$shop["name"]."'"?>)" title="Tolak">
                    <img src="<?php echo $this->baseUrl(); ?>/images/icons/delete.png" alt="Tolak" />
                </a>
            </td>
        </tr>
        <?php
                }
        ?>
    </table>
    <?php
        // navigator
        echo $this->back;
        echo $this->current;
        echo $this->next;
    ?>
    <div id="rejection">
        <form name="frmReason" action="pending" method="POST">
            <b>Apa alasan Anda menolak permohonan toko ini?</b><br><br>
            Masukkan alasan Anda dan tekan "Tolak" apabila masih ingin memproses permohonan toko, atau tekan "Hapus" apabila ingin langsung menghapus toko.<br><br>
            <?php echo $this->formTextArea("reason",null,array("cols"=>"45","rows"=>"7","style"=>"resize:none;")); ?><br><br>
            <?php echo $this->formHidden("shopId","0"); ?>
            <?php echo $this->formHidden("shopName",""); ?>
            <?php echo $this->formSubmit("pending","Tolak",array("onClick"=>"return chkReason()")); ?>&nbsp;
            <?php echo $this->formSubmit("reject","Hapus"); ?>&nbsp;
            <?php echo $this->formButton("cancel","Batal",array("onClick"=>"javascript: document.getElementById('rejection').style.display = 'none';")); ?>
        </form>
    </div>
    <div id="hiddenform" style="display:none;">
        <form name="frmAccept" action="pending" method="POST">
            <?php echo $this->formHidden("shopId","0"); ?>
            <?php echo $this->formHidden("shopName",""); ?>
            <?php echo $this->formHidden("accept","Setujui"); ?>
        </form>
    </div>
</div>